package com.xzr.yespaper.service;

import com.xzr.yespaper.bean.Files;
import com.xzr.yespaper.mapper.FilesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class FilesService {

    @Autowired
    FilesMapper filesMapper;

    /**
     * 根据用户id得到相关文件 Get file by user id
     * @param fid Long user_id
     * @return Files
     */
    public List<Files> getFilesByFirstID(Long fid){
        return filesMapper.getByFid(fid);
    }

    /**
     * 创建文件 Create file (image)
     * @param files com.xzr.yespaper.bean.Files
     */
    public void creatFiles(Files files){
        filesMapper.createByFid(files);
    }

    /**
     * 更改文件 Update file (image)
     * @param files com.xzr.yespaper.bean.Files
     */
    public void updateFilesAddress(Files files){
        filesMapper.updateAddressByFid(files);
    }

}
